package br.net.woodstock.tickettoride.jee6.web.security;

import javax.inject.Named;
import javax.interceptor.InvocationContext;

import br.net.woodstock.rockframework.web.faces.security.LogonValidator;
import br.net.woodstock.tickettoride.web.jsf.security.common.JSFConstants;
import br.net.woodstock.tickettoride.web.jsf.security.common.JSFSecurityUtils;

@Named("localLogonValidator")
public class LocalLogonValidator implements LogonValidator {

	private static final long	serialVersionUID	= 7711434443803844523L;

	@Override
	public boolean isValid(final InvocationContext context) {
		return JSFSecurityUtils.isLoggedIn();
	}

	@Override
	public Object onInvalid(final InvocationContext context) {
		return JSFConstants.LOGIN_PAGE;
	}

}
